<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/1/17
  Time: 12:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>OA管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
    <script>
        //一般直接写在一个js文件中
        layui.use(['layer', 'form','element'], function(){
            var layer = layui.layer
            var form = layui.form;

          //  layer.msg('Hello World');

           var names= new Array("我的桌面","通告管理","文档管理","行政管理","人事管理","系统管理")

           var jsp=['/jsp/desktop.jsp','/jsp/inform.jsp','/jsp/document.jsp','/jsp/administrative.jsp','/jsp/personnel.jsp','' +
           '/jsp/system.jsp'];
            for (var i=0;i<names.length;i++){
                addTab(i,names[i],jsp[i])
            }

            //监听修改状态修改表单内容
            form.on('submit(updateSubmitFilter)', function(data){
                /*console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}*/
                $.ajax({
                    url:"${pageContext.request.contextPath}/updatePassword"
                    ,data:data.field
                    ,success:function (data) {
                        var msg="修改失败"
                        if (data.isUpdate) {
                            msg="修改成功"
                            layer.closeAll()
                        }
                        layer.msg(msg)
                    }
                })
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });



        });

        function addTab(id,name,url) {
            var $= layui.jquery
            var element = layui.element;
            //alert(000)
            if ($("li[lay-id='"+id+"']").length==0){
                element.tabAdd('demo', {
                    title: name
                    ,content: '<iframe src='+url+' frameborder="0" id="demoAdmin" style="width: 100%; height: 500px;"></iframe>' //支持传入html
                    ,id: id
                });
            }
            element.tabChange("demo", id);
        }
        function update() {

            layer.open({
                type: 1,
                content: $('#addform')
            })

        }


    </script>
</head>






<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">OA管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">控制台</a></li>
            <li class="layui-nav-item"><a href="">商品管理</a></li>
            <li class="layui-nav-item"><a href="">用户</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    贤心
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="javascript:update();">修改密码</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退了</a></li>
        </ul>
    </div>



    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <div class="layui-tab" lay-filter="demo" >
                <ul class="layui-tab-title">
                   <%-- <li class="layui-this">欢迎页</li>--%>
                </ul>
                <div class="layui-tab-content">
                    <%--<div class="layui-tab-item layui-show">欢迎登录</div>--%>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>


<!--//修改表单-->
<form class="layui-form" style="display: none;" id="addform" lay-filter="formFilter"> <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <div class="layui-form-item">
        <label class="layui-form-label">旧密码:</label>
        <div class="layui-inline">
            <input type="text" name="password" lay-verify="required" placeholder="请输入旧密码"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">新密码:</label>
        <div class="layui-inline">
            <input type="text" name="new1" lay-verify="required" placeholder="请输入新密码"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确定新密码:</label>
        <div class="layui-inline">
            <input type="text" name="new2" lay-verify="required" placeholder="请输入新密码"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="updateSubmitFilter">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
    <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
</form>
</body>
</html>
